/*
 * stream.cc
 *
 *  Created on: Dec 16, 2014
 *      Author: root
 */

#include <stdio.h>
#include <string.h>
#include "stream.h"

Stream::Stream(Socket client, Socket server) {
	this->client = client;
	this->server = server;
}
void Stream::ToString() const {
	char info[128] = { 0 };
	sprintf(info, "%s-->", this->client.ToString());
	sprintf(info + strlen(info), "%s", this->server.ToString());
	printf("%s\n", info);
}
bool Stream::operator<(const Stream& t) const {
	if (this->client.addr != t.client.addr)
		return this->client.addr < t.client.addr;
	if (this->client.port != t.client.port)
		return this->client.port < t.client.port;
	if (this->server.addr != t.server.addr)
		return this->server.addr < t.server.addr;
	if (this->server.port != t.server.port)
		return this->server.port < t.server.port;
	return false;
}
